package edu.yonsei.iwb.smarttv.querygraph;

import com.hp.hpl.jena.rdf.model.Resource;
import edu.yonsei.iwb.smarttv.model.ResourceNode;
import java.util.Vector;

/**
 * 사용자 질의를 QueryKeyword 별로 담기 위한 클래스
 * 
 * @author Joo
 */
public class QueryCombination extends Vector<ResourceNode> {

    public QueryCombination() {
    }

    public QueryCombination(QueryCombination qc) {
        this.addAll(qc);
    }

    public Vector<Resource> getAllMappedResource() {
        Vector<Resource> rSet = new Vector<Resource>();
        for (int i = 0; i < this.size(); i++) {
            ResourceNode rn = this.get(i);
            Resource r = rn.getNode();
            if (!rSet.contains(r)) {
                rSet.add(r);
            }
        }
        return rSet;
    }

    @Override
    public String toString() {
        StringBuffer sb = new StringBuffer();
        sb.append("[");
        for (int i = 0; i < this.size(); i++) {
            sb.append(this.get(i).toString());
            if (i != (this.size() - 1)) {
                sb.append(", ");
            }
        }
        sb.append("]");
        return sb.toString();
    }
}
